
<template>
  <avue-crud
    ref="crud"
    :page="page"
    :data="tableData"
    :table-loading="tableLoading"
    :option="tableOption"
    @on-load="getList"
  >
    <template
      slot="errMsg"
      slot-scope="scope"
    >
      <span style="color: red">{{scope.row.errMsg}}</span>
    </template>
    <template slot="bankName">
      <span>{{bankType === 'boc' ? '中国银行' : '建设银行'}}</span>
    </template>
  </avue-crud>
</template>

<script>
import { tmp } from "@/api/rca/swckbackelectronicbill";
import { tmpTableOption } from "@/const/crud/rca/swckbackelectronicbill";
import { mapGetters } from "vuex";

export default {
  name: "TempData",
  data () {
    return {
      searchForm: {},
      tableData: [],
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 20, // 每页显示多少条
      },

      tableLoading: false,
    };
  },
  props: ["bankType"],
  computed: {
    tableOption () {
      const { bankType } = this;
      return tmpTableOption[bankType];
    },
  },
  methods: {
    getList (page, params) {
      this.tableLoading = true;
      tmp[this.bankType]
        .list({})
        .then((response) => {
          this.tableData = response.data.data;
          this.page.total = 0;
          this.tableLoading = false;
        })
        .catch(() => {
          this.tableLoading = false;
        });
    },
  },
};
</script>
